//
//  ZFHomeHttpRequest.m
//  HappilyLoan
//
//  Created by zainishenbian on 2017/4/7.
//  Copyright © 2017年 zongqingxiangqian. All rights reserved.
//

#import "ZFHomeHttpRequest.h"
#import "ZFHeader.h"

@implementation ZFHomeHttpRequest
//首页轮播图请求
+ (void)requestBannerInfoComplete:(void(^)(NSDictionary *dict))successBlock failureBlock:(void(^)(NSInteger failSign))failureBlock;
{
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/system/findBannerInfoList",SERVERIP] params:nil bodyStr:@"" success:^(id responseObject) {
        successBlock(responseObject);
//        NSLog(@"%@",responseObject);
    } failure:^(NSError *error) {
        failureBlock(1);
        NSLog(@"%@",error);
    }];
}
//获取贷钱快数据列表
+ (void)requestDQKListInfoApplyamt:(NSString *)applyamt loanTerm:(NSString *)loanTerm Complete:(void(^)(NSDictionary *dict))successBlock failureBlock:(void(^)(NSInteger failSign))failureBlock
{
    NSDictionary *bodyparameter = @{@"user_id":[ZFPulicAPI getUserid],@"apply_amt":applyamt,@"loan_term":loanTerm};
    
    NSString *bodyStr = [ZFHttpTool sortBodyStr:bodyparameter];

    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/system/getProductList",SERVERIP] params:bodyparameter bodyStr:bodyStr success:^(id responseObject) {
        
        successBlock(responseObject);
        NSLog(@"%@-----%@",responseObject,responseObject[@"msg"]);
    } failure:^(NSError *error) {
        failureBlock(1);
    }];
}
//APP开关设置
+ (void)requestAppSwitchComplete:(void(^)(NSDictionary *dict))successBlock failureBlock:(void(^)(NSInteger failSign))failureBlock
{
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/system/findAppSwitchConfig",SERVERIP] params:nil bodyStr:@"" success:^(id responseObject) {
        NSLog(@"%@",responseObject);
        successBlock(responseObject);
    } failure:^(NSError *error) {
        
    }];
}
//获取一个活动
+ (void)requestFindOneActivitySucessBlock:(void (^)(NSDictionary *))successBlock failureBlock:(void (^)(NSInteger))failureBlock{
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/system/findOneActivity",SERVERIP] params:nil bodyStr:@"" success:^(id responseObject) {
        
        successBlock(responseObject);
    } failure:^(NSError *error) {
        
        failureBlock(1);
    }];
}
@end
